package entity

type License struct {
	DCI         string `json:"dci,omitempty" required:"true"`
	Seller      string `json:"seller,omitempty" required:"true"`
	BlockNumber uint64 `json:"blockNumber,omitempty" required:"true"`
	Price       string `json:"price,omitempty" required:"true"`
	Duration    string `json:"duration,omitempty" required:"true"`
	Count       uint64 `json:"count,omitempty" required:"true"`

	Name            string `json:"name,omitempty" required:"true"`
	Description     string `json:"description,omitempty" required:"true"`
	Category        string `json:"category,omitempty"`
	BlockTime       uint64 `json:"blockTime,omitempty" required:"true" example:"14000000"`
	BlockTimeString string `json:"blockTimeString,omitempty" required:"true" example:"2020-01-01 01:01:01"`
}

type LicenseEvent struct {
	DCI   string `json:"dci,omitempty" required:"true"`
	From  string `json:"from,omitempty" required:"true"`
	To    string `json:"to,omitempty" required:"true"`
	Price string `json:"price,omitempty" required:"true"`

	BlockNumber uint64 `json:"blockNumber,omitempty" required:"true"`
	EventName   string `json:"eventName,omitempty" required:"true"`
	TxHash      string `json:"txHash,omitempty" required:"true"`
}

type LicenseRecord struct {
	Name              string `json:"name,omitempty" required:"true"`
	TxHash            string `json:"txHash,omitempty" required:"true"`
	RecordId          uint64 `json:"recordId,omitempty" required:"true"`
	DCI               string `json:"dci,omitempty" required:"true"`
	Seller            string `json:"seller,omitempty" required:"true"`
	SellerUsername    string `json:"sellerUsername,omitempty" required:"true"`
	Buyer             string `json:"buyer,omitempty" required:"true"`
	BuyerUsername     string `json:"buyerUsername,omitempty" required:"true"`
	Price             string `json:"price,omitempty" required:"true"`
	CreatedTime       uint64 `json:"createdTime,omitempty" required:"true"`
	CreatedTimeString string `json:"createdTimeString,omitempty" required:"true"`
	Deadline          uint64 `json:"deadline,omitempty" required:"true"`
	DeadlineString    string `json:"deadlineString,omitempty" required:"true"`
	Type              uint8  `json:"type,omitempty" required:"true"`
}

// Trade 所有类型交易
type Trade struct {
	DCI             string `json:"dci,omitempty" required:"true"`
	Name            string `json:"name" required:"true" example:"作品名称"`
	Description     string `json:"description,omitempty" example:"作品介绍"`
	Category        string `json:"category" required:"true" example:"image"`
	Type            string `json:"type" required:"true" example:" 售卖类型"`
	BlockTime       uint64 `json:"blockTime,omitempty" required:"true" example:"14000000"`
	BlockTimeString string `json:"blockTimeString,omitempty" required:"true" example:"2020-01-01 01:01:01"`
}

// GetLicenseUri 获取授权信息请求
type GetLicenseUri struct {
	DCI string `uri:"dci" binding:"required" path:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
}

// GetLicenseResponse 获取授权信息请求的响应
type GetLicenseResponse struct {
	Response
	Data License `json:"data,omitempty"`
}

// GetLicensesQuery 获取授权信息集合请求
type GetLicensesQuery struct {
	Pagination
	BlockTimeSearch
	NameSearch
	ItemTypeSearch
	DCI    string `form:"dci" query:"dci" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
	Seller string `form:"seller" query:"seller" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
}

// GetLicensesResponse 获取授权信息集合的响应
type GetLicensesResponse struct {
	Response
	Data []License `json:"data,omitempty"`
}

// GetLicenseEventsQuery 获取授权事件记录请求
type GetLicenseEventsQuery struct {
	Pagination
	DCI         string `form:"dci" binding:"required" query:"dci" required:"true" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
	Seller      string `form:"seller" query:"seller" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	EventName   string `form:"eventName" query:"eventName" example:"create"`
	BlockNumber uint64 `form:"blockNumber" query:"blockNumber" example:"10000"`
}

// GetLicenseEventsResponse 获取授权事件记录请求的响应
type GetLicenseEventsResponse struct {
	Response
	Data []LicenseEvent `json:"data,omitempty"`
}

// GetLicenseRecordsQuery 获取授权信息集合请求
type GetLicenseRecordsQuery struct {
	Pagination
	DCI      string `form:"dci" query:"dci" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
	RecordID uint64 `form:"recordId" query:"recordId" example:"1"`
	Seller   string `form:"seller" query:"seller" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	Buyer    string `form:"buyer" query:"buyer" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	Deadline uint64 `form:"deadline" query:"deadline" example:"1637828202"`
}

// GetLicenseRecordsResponse 获取授权信息集合的响应
type GetLicenseRecordsResponse struct {
	Response
	Data []LicenseRecord `json:"data,omitempty"`
}

// GetTradesQuery 获取所有类型交易集合请求
type GetTradesQuery struct {
	Pagination
	BlockTimeSearch
	NameSearch
	ItemTypeSearch
	TradeTypeSearch
	DCI    string `form:"dci" query:"dci" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
	Seller string `form:"seller" query:"seller" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
}

// GetTradesResponse 获取所有类型交易集合的响应
type GetTradesResponse struct {
	Response
	Data []Trade `json:"data,omitempty"`
}

// GetLicenseRecordQuery 获取某条授权记录
type GetLicenseRecordQuery struct {
	DCI      string `form:"dci" query:"dci" example:"0x3e6cf1025bc0852b7141ab19a097305a3935ebb9cc23d4f507c6ccce112be73c"`
	Buyer    string `form:"buyer" query:"buyer" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	Seller   string `form:"seller" query:"seller" example:"0xfC97a1A683FB0108299D5725BC9d72899C9A86B4"`
	RecordID uint64 `form:"recordId" query:"recordId" example:"1"`
	Deadline uint64 `form:"deadline" query:"deadline" example:"14000000000"`
}

// GetLicenseRecordResponse 获取所有类型交易集合的响应
type GetLicenseRecordResponse struct {
	Response
	Data LicenseRecord `json:"data,omitempty"`
}
